package com.shkmall.goods.controller;

import com.shkmall.common.pojo.Result;
import com.shkmall.common.pojo.StatusCode;
import com.shkmall.goods.pojo.Spec;
import com.shkmall.goods.service.SpecService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/spec")
public class SpecController {
    @Autowired
    private SpecService specService;

    @GetMapping("/findSpecByCategory/{categoryName}")

    public Result findSpecByCategory(@PathVariable("categoryName") String categoryName) {

        List<Map> data = specService.findSpecByCategory(categoryName);

        return new Result(true, StatusCode.OK, "查询成功", data);
    }
}
